// C1 E18 Edition1

#include <stdio.h>

#define MAXLINE 1000
#define LONGS 80

int getstr(char s[], int lim);
// void copystr(char source[], char dest[]);

int main()
{
    int len;
    int i;
    char s[MAXLINE];

    len = 0;

    while ((len = getstr(s, MAXLINE)) > 0)
    {
        i = len;
        if (s[i - 1] == '\n') // Case 1: have'\n'
        {
            i--;
            while (s[i - 1] == ' ' || s[i - 1] == '\t')
                s[i - 1] = '\n', s[i] = '\0', i--;
            i++;
        }
        else // Case 2: not have'\n'
        {
            while (s[i - 1] == ' ' || s[i - 1] == '\t')
                s[i - 1] = '\0', i--;
        }

        if ((i == 1 && s[0] == '\n') || (i == 0))
            printf("\n>>>Blank, delete.\n");
        else
            printf("\n>>>Source length = %3d\tNow length = %3d\n>>>%s\n\n", len, i, s);
    }

    return 0;
}

int getstr(char s[], int lim)
{
    int c;
    int i;

    i = 0;
    lim = MAXLINE;

    while (i < lim - 1 && (c = getchar()) != EOF && c != '\n')
    {
        s[i] = c;
        i++;
    }
    if (c == '\n')
        s[i] = '\n',
        i++;
    s[i] = '\0';

    return i;
}